#include "../Filesystem.h"

#include <stdio.h>
#include <string>

#define BOOST_TEST_MODULE FileSystemTest
#define BOOST_TEST_MAIN
#define BOOST_TEST_DYN_LINK
#include <boost/test/unit_test.hpp>

using std::string;
using namespace ftp;
using namespace ftp::Filesystem;

BOOST_AUTO_TEST_CASE(testCleanPath)
{
	const char seperator = '/';

	// absolute path
	BOOST_CHECK_EQUAL("/", simplifyPath("/", seperator));
	BOOST_CHECK_EQUAL("/a", simplifyPath("/a", seperator));
	BOOST_CHECK_EQUAL("/a/", simplifyPath("/a/", seperator));
	BOOST_CHECK_EQUAL("/abcd123456", simplifyPath("/abcd123456", seperator));
	BOOST_CHECK_EQUAL("/abcd123456/", simplifyPath("/abcd123456/", seperator));
	BOOST_CHECK_EQUAL("/abcd123456/abcd123456", simplifyPath("/abcd123456/abcd123456", seperator));
	BOOST_CHECK_EQUAL("/abcd123456/abcd123456/", simplifyPath("/abcd123456/abcd123456/", seperator));

	string path(512, 'x');


	// relative path
	BOOST_CHECK_EQUAL(".", simplifyPath(".", seperator));
	BOOST_CHECK_EQUAL("./", simplifyPath("./", seperator));
}
